package com.hxx.day2;

import org.junit.Test;

public class TestDemo12 {
    public static void main(String[] args) {
        Animal animal = new Cat();
        animal.move();
        //成员变量不能被覆盖
        System.out.println(animal.age);
    }

    @Test
    public void test1(){
        //静态方法不能被覆盖
        A a = new B();
        a.show();
    }
}
//父类
class Animal{
    public int age = 35;
    public void move(){
        System.out.println("动物在移动...");
    }
}
//子类
class Cat extends Animal{

    public int age = 5;
    public void move(){
        System.out.println("猫在移动...");
    }
}

class A{
    public static void show(){
        System.out.println("---------->>show()");
    }
}

class B extends A{
    public static void show(){
        System.out.println("show()");
    }
}

























